*******************************************************************************************
***		    	iDmacX NESiCA System Emulator Version 1.3	   (06/21/2017) ***
***					Special Thanks,					***
***		       Community of 1cc, Dendygar, mAGoLoUCo, FlyBit			***
***											***
***	Homepage: http://8ch.net/1cc/index.html						***
***					      				      by FlyBit	***
*******************************************************************************************
[ Community of 1cc ] - Main Engine, technical data, tests and designer.
[ Dendygar ] - Technical data and tests.
[ mAGoLoUCo ] - Technical data of the pipe code. - Salve Galera!
[ FlyBit ] - Reversal of CryptServer, Nesys and RFiD. - Salve Galera!


********************** [ HISTORY ] **********************

Current version (iDmacX v1.2 rc3):
- Added Connect a 2nd Fast IO (Player 3 and 4)
- Added search function of CryptServer keys * .key
- Fixed Winmm Poll

Fourth version (iDmacX v1.2 rc1):
- Fixed Keyboard input by Dinput for some games:
707 Crimzon Clover(XP)
876 Dragon Dance
1103 Magical Beat
705 Raiden IV(XP)
628 Trouble Witches AC Amalgam no Joutachi
- New functions added for future games.
- Xbox and Winmm Poll rewrite.
- Including the NesysOffline.exe file
- Nesys rewrite.
- RFiD rewrite.
- It works on WindowsXP. ( Remove the file dinput8.dll )

Third version (iDmacX v1.2):
- Fixed a little bug in CryptServer emulation. Error: "Init failed" (FIX)
Now it checks and creates the key on disk.
If you need permission, probably run the game as Administrator.
- Fixed the reading of joysticks buffers.
- Return of the default code for coins on joystick 1.

Second version (iDmacX v1.1):
- Support for XBox control.
- Support for joysticks using Winmm and GetAsyncKeystate.
- Support for individual game options.
- Automatic creation of system registry keys, you need to start JConfig as administrator.
- Support the creation of the sv folder in the current directory.
- Nesys offline emulation support.
- RFiD emulation support.
- Added a fix to the main engine to assimilate coin in other games. [Thanks Dendygar]
(When you click on coin, you will probably add more than 1 coin (We will still fix it better)).
- Fixed bug in Rumble Fish 2. Error: "Not recognize Key Board".

First release (iDmacX v1.0):
- Support for joysticks and player2.
- CryptServer emulation support.
- DirectSound wrapper support.
- DirectX9c wrapper support.
- Window Mode Support.
- Poll of the joysticks improved.


********************** [ NOTES ABOUT JConfig ] **********************

- High Resolution: On/Off Sets the game to run in 480P or 720P Natively.

- DirectSound Wrapper: Enable/Disable Directsound Wrapper ( Fixes sound issues in some games related to certain audio devices ).

- Direct3D9 Wrapper*: Enable/Disable D3D9 Hook, with this enabled you can Force the game's internal Resolution to render at the defined Resolution.
- DX Window Mode*: Enable/Disable Attempt to force the game into a windowed state the windows size can be defined with the window settings.

*All DX Related Hooks Will only work if the game is a Directx 9 Game, and not all games are supported.

- Delay: Adds a pause in the poll loop of the joysticks.

- Reverse: Reverse the order of the joysticks.

- CreateThread for Joysticks: Creates a parallel thread to read the joysticks, not interfering with the flow  
the emulator's main engine. Disable this item when games are out of sync with the machine.

- Joystick Type: Four different types of readings for joysticks.
-- Dinput&Xinput: Only works by disabling the CreateThread for Joysticks option.
-- DInput (Default)
-- Xinput (XBox Gamepad)
-- Winmm
-- GetAsyncKeystate

Commands for GetAsyncKeyState.
P1START		[1]
P1COIN		[2]
P1SERVICE	[6]
P1UP		[W]
P1DOWN		[S]
P1LEFT		[A]
P1RIGHT		[D]
P1BUTTON1	[U]
P1BUTTON2	[I]
P1BUTTON3	[O]
P1BUTTON4	[J]
P1BUTTON5	[K]
P1BUTTON6	[L]
P2START		[3]
P2COIN		[4]
P2SERVICE	[7]
P2UP		[UP]
P2DOWN		[DOWN]
P2LEFT		[LEFT]
P2RIGHT		[RIGHT]
P2BUTTON1	[NUMPAD7]
P2BUTTON2	[NUMPAD8]
P2BUTTON3	[NUMPAD9]
P2BUTTON4	[NUMPAD4]
P2BUTTON5	[NUMPAD5]
P2BUTTON6	[NUMPAD6]
TESTMODE	[8]
EXIT		[9]

- XBox Single Joystick: When the XBox control is connected together with some control:
Enabled: Generic Joystick1, Generic Joystick2, Xbox Joystick3, Xbox Joystick4;

Disable: Generic Joystick1 = Xbox Joystick1
	 Generic Joystick2 = Xbox Joystick2.

- DEADZONE Sensitivity: Changes the pickup sensitivity of the joystick axes.

- Button Settings [ NESiCA Settings ]:

-- Individual Game Settings:
Enable/Disable this allows per game overrides in settings.

--- Coins Per Credit: The amount of coins required for play 0 will set Fast Io games to freeplay.
	1 - Coins Active (Game requires coins)
	0 - Free Play on (Game is FREE play)

--- Resolution HD Mode: On/Off Fast IO Game's version of High Res Mode. On for 720p Off for 480.
	1 = HD mode 1280x720
	0 = SD mode 640x480

--- Screen Vertical ( Tate Mode ): On/Off  If enabled , Games that support tate mode will be Rotated by 90.
	0 = Horizontal Screen mode (Normal play mode)
	1 = Vertical Screen mode (TATE mode)

Load RegEdit Attempts to Load the default keys out of YOUR windows registry allowing you to change the settings and SAVE 
the changes, these settings only apply when individual mode is turned off, JConfig MUST be ran as admin to do this. 

-- Load Regedit: Allows access to the universal NESiCA settings.
Loads or Creates the options in the system registry.

-- Save Regedit: Saves changes to the system registry.

-- CryptServer Emulation: Enable/Disable .Key Emulation ( The keyfile some games need )

-- Nesys Emulation: Enable/Disable Network Bypass.

-- RFiD Emulation: Enable/Disable Card Reader Emulation  You can select Emulated board type Default is Namco.

-- Save Patch: Enable/Disable Attempts to patch the game to force all SAVE DATA to be placed in the SV folder inside the main game.
Only tree games don't work:
701 Do Not Fall - Run For Your Drink
880 King of Fighters 98 Ultimate Match Final Edition (Ranking don't load)
881 King of Fighters 2002 Unlimited Match (Ranking don't load)

-- Connect a 2nd Fast IO: Enable/Disable Will attach a 2nd Fast io emulator, this enables 3rd and 4th player support for Future Games.


********************** [ADDITIONAL NOTES] **********************

- 100% TTX, doesn't need the iDmacDrv32.dll file, use JVSEmu.dll.
706 3D Cosplay Mahjong
875 Battle Fantasy

- 100% for Windows, you don't need the iDmacDrv32.dll file.
886 Spica Adventure.

- It doesn't work with Dinput. Use Winmm, GetAsyncKeyState or Xinput.
876 Dragon Dance
883 Space Invaders


********************** [ADDITIONAL NOTES 2] **********************

To run the games, they depend on 3 external programs.
Run the programs below separately OR select the options in JConfig.
NOTE: Don't use both at the same time!

- RFiDGod.dll
- Copy the dll file to the C:\RFiD
- Run the RFIDGod_inject.exe inside the game folder.
or
- Select the RFiD Emulation option.

- Nesysservice.exe
- Run the Nesysservice.exe -app command
or
- Select the Nesys Emulation option.

- Cryptserver.exe
- Run the command Cryptserver.exe <path of key.key>
or
- Select the Crypserver Emulation option and leave the key in the game directory.

NOTE2: Not all programs are required, see table below.


Games that have no instruction, run directly from the executable.
 ______ ________________________________________________________ _______ _______ _____________ _____________ _______ _________________________________
|      |                         Game                           | RFiD  | Nesys | CryptServer | 2 Fast Io's | D3D9  |              Note               |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  01  |>>706 3D Cosplay Mahjong                                |       |       |	      |             |       | is ttx_monitor, use JVSEmu.dll  |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  02  |>>1127 Akai Katana Shin [302201]                        |   X   |   *   |	      |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  03  |>>623 Aquapazza Aquaplus Dream Match                    |   X   |   X   |	      |             |   *   |        d3d9.dll (to remove)     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  04  |>>710 Arcana Heart 2 v2.1                               |       |       |	      |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  05  |>>626 Arcana Heart 3 LOVE MAX SIX STARS                 |   X   |   X   |	      |             |   *   |        d3d9.dll (to remove)     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  06  |>>875 Battle Fantasia                                   |       |       |	      |             |       | is ttx_monitor, use JVSEmu.dll  |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  07  |>>BlazBlue Central Fiction [304005]                     |   X   |   *   |      X      |             |   *   |    302510.key OR 300109.key     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  08  |>>BlazBlue Central Fiction [304007] v1.30.01            |   X   |   *   |      X      |             |   *   |    302510.key OR 300109.key     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  09  |>>720 BlazBlue Chrono Phantasma                         |   X   |   *   |      X      |             |   *   |           302510.key            |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  10  |>>BlazBlue Continuum Shift 2                            |   X   |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  11  |>>702 Chaos Code New Sign of Catastrophe                |       |       |             |             |   *   |  Direct3D9 Wrapper (unstable)   |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  12  |>>Chaos Code New Sign of Catastrophe [303305] v2.11     |       |   X   |             |             |   *   |  Direct3D9 Wrapper (unstable)   | -> In JConfig disable the Nesys option and run the NesysOffline.exe file
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  13  |>>707 Crimzon Clover                                    |   X   |   X   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  14  |>>1124 Daemon Bride Additional Gain [401901]            |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  15  |>>701 Do Not Fall Run For Your Drink                    |   X   |   *   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  16  |>>876 Dragon Dance                                      |       |       |             |             |       |                                 | -> Only works with Winmm Only or GetAsyncKeyState Only
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  17  |>>877 Elevator Action                                   |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  18  |>>629 En-Eins Perfektewelt                              |       |       |             |             |   *   |  Direct3D9 Wrapper (unstable)   |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  19  |>>634 Exception                                         |   X   |   *   |             |             |       |     opengl32.dll (to remove)    |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  20  |>>878 Goketsuji Ichizoku Matsuri Senzo Kuyo             |       |       |             |             |       |        doesn't work yet         |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  21  |>>709 Homura                                            |       |       |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  22  |>>884 Hyper Street Fighter II The Anniversary Edition   |   X   |   *   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  23  |>>630 Ikaruga                                           |   X   |   X   |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  24  |>>881 King of Fighters 2002 Unlimited Match             |   X   |   X   |             |             |   *   |        d3d9.dll (to remove)     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  25  |>>880 King of Fighters 98 Ultimate Match Final Edition  |   X   |   X   |             |             |   *   |        d3d9.dll (to remove)     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  26  |>>1103 Magical Beat                                     |   X   |   X   |      X      |             |   *   |           302303.key            |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  27  |>>625 Nitroplus Blasterz                                |   X   |   X   |             |             |   *   |        d3d9.dll (to remove)     |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  28  |>>719 Persona 4 The Ultimax Ultra Suplex Hold           |   X   |   *   |      X      |             |   *   |           303108.key            |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  29  |>>1558 Persona 4 The Ultimate in Mayonaka Arena         |   X   |   X   |      X      |             |   *   |           302104.key            |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  30  |>>708 Psychic Force 2012                                |       |       |             |             |       |      game.exe ou game2.exe      |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  31  |>>632 Puzzle Bobble                                     |   X   |   X   |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  32  |>>703 Raiden III                                        |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  33  |>>705 Raiden IV                                         |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  34  |>>882 Rastan Saga                                       |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  35  |>>638 Rumble Fish 2                                     |       |       |             |             |       |     Release\game\game.exe       |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  36  |>>1117 Senko no Ronde DUO v.2.35                        |   X   |       |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  37  |>>872 Skullgirls                                        |   X   |   X   |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  38  |>>883 Space Invaders                                    |       |       |             |             |       |                                 | -> Only works with Winmm Only or GetAsyncKeyState Only
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  39  |>>886 Spica Adventure                                   |       |       |             |             |       |100% for Windows Start F1/Coin F2|
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  40  |>>627 Strania The Stella Machina                        |   X   |   *   |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  41  |>>631 Street Fighter 3 Third Strike                     |   X   |   *   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  42  |>>633 Street Fighter Zero 3                             |   X   |   *   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  43  |>>712 Suggoi! Arcana Heart 2 v2.6                       |       |       |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  44  |>>885 Tottemo E Mahjong                                 |       |       |             |             |   *   |     game.exe ou game2.exe       |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  45  |>>628 Trouble Witches AC Amalgam no Joutachi            |       |       |             |             |   *   |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  46  |>>887 Vampire Savior The Lord of Vampire                |   X   |   *   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|  47  |>>624 Yatagarasu Attack on Cataclysm                    |   X   |   X   |             |             |       |                                 |
|------|--------------------------------------------------------|-------|-------|-------------|-------------|-------|---------------------------------|
|      |                                                        |  26X  |13X 12*|     6X      |             |  27*  |                                 |
 ------ -------------------------------------------------------- ------- ------- ------------- ------------- ------- --------------------------------- 
X - Required
* - Optional